package com.example.exceptions;

import com.example.exceptions.myExceptions.BussinessException;
import com.example.pojo.vo.Result;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
public class MyExceptionHandler {
    @ExceptionHandler(BussinessException.class)
    public Result doBussinessExceptionHandler(BussinessException be) {
        be.printStackTrace();
        return new Result(false, "业务异常");
    }
    @ExceptionHandler(Exception.class)
    public Result doExceptionHandler(Exception be) {
        be.printStackTrace();
        return new Result(false, "系统异常");
    }
}
